package com.itheima02;

public class Test01 {
    public static void main(String[] args) {
        useAnimal(new dog("黄毛",4));
        useAnimal(new cat("白毛",3));
    }
    public static void useAnimal(Animal a){
        a.eat();
        System.out.println(a.getAge());
        System.out.println(a.age);
    }
}
abstract class Animal{
    private String breed;
     int age;

    public Animal() {
    }

    public Animal(String breed, int age) {
        this.breed = breed;
        this.age = age;
    }

    public String getBreed() {
        return breed;
    }

    public void setBreed(String breed) {
        this.breed = breed;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    public abstract void eat();
}
class cat extends Animal{
    public cat() {
    }

    public cat(String breed, int age) {
        super(breed, age);
    }
    public void eat(){
        System.out.println("猫吃猫粮..");
    }
    public void cach(){
        System.out.println("猫抓老鼠..");
    }

    }

class dog extends Animal{
    public dog() {
    }

    public dog(String breed, int age) {
        super(breed, age);
    }
    public void eat(){
        System.out.println("狗吃肉..");
    }
    public void lookhome(){
        System.out.println("狗看家.");
}
}
